package com.lagou.edu.context;

import com.lagou.edu.factory.BeanFactory;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class ContextListener implements ServletContextListener {

    private BeanFactory beanFactory;

    /**
     * web容器初始化
     * @param servletContextEvent
     */
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        this.beanFactory = BeanFactory.getInstance();
    }

    /**
     * web容器销毁
     * @param servletContextEvent
     */
    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        this.beanFactory = null;
    }
}
